@extends('shop::layouts.master')
@section('title')
    结算列表
@endsection
@section('tab')
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">

                    </div>
                    <div class="layui-card-body ">
                        <div class="layui-input-inline layui-show-xs-block">
                            @if(intval($settle_data['can'] * 100) > 0)
                                <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加结算','{{route("shop_account_settle_add_page")}}',800,600)">可结算：{{$settle_data['can']}}</button>

                            @else
                                <button class="layui-btn layui-btn-normal layui-btn-disabled" >可结算：{{$settle_data['can']}}</button>

                            @endif
                            <a class="layui-btn" onclick="location.reload()">
                                <i class="layui-icon layui-icon-refresh"></i>
                            </a>
                        </div>

                        <form class="layui-form layui-col-space5">

                        </form>
                    </div>

                    <div class="layui-card-body layui_overflow_y ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>收款账户信息</th>
                                <th>打款账户信息</th>
                                <th>结算证明</th>
                                <th>结算总额</th>
                                <th>实际转账总额</th>
                                <th>手续费率</th>
                                <th>提交时间</th>
                                <th>结算时间</th>
                                <th>状态</th>
                                <th>驳回状态</th>
                                <th>驳回原因</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data))
                            @foreach($data as $key=>$value)
                                <tr>
                                    <td>{{$key+1}}</td>
                                    <td>
                                        @if($value['in_account_type'] === 'ali')
                                            支付宝账号：{{$value['in_ali_account']}}<br/>
                                            户主姓名：{{$value['in_ali_account_realname']}}<br/>
                                        @endif

                                        @if($value['in_account_type'] === 'bank')
                                            银行名称：{{$value['in_bank']}}<br/>
                                            支行名称：{{$value['in_bank_branch']}}<br/>
                                            银行卡号：{{$value['in_bank_card']}}<br/>
                                            户主姓名：{{$value['in_bank_card_realname']}}<br/>
                                        @endif
                                    </td>

                                    <td>
                                        @if($value['out_account_type'] === 'ali')
                                            支付宝账号：{{$value['out_ali_account']}}<br/>
                                            户主姓名：{{$value['out_ali_account_realname']}}<br/>
                                        @endif

                                        @if($value['out_account_type'] === 'bank')
                                            银行名称：{{$value['out_bank']}}<br/>
                                            支行名称：{{$value['out_bank_branch']}}<br/>
                                            银行卡号：{{$value['out_bank_card']}}<br/>
                                            户主姓名：{{$value['out_bank_card_realname']}}<br/>
                                        @endif
                                    </td>
                                    <td>
                                        @if(empty($value['settle_testify_img']))

                                        @else
                                            <img src="{{$value['settle_testify_img']}}" style="width: 80px;height: 80px;" class="Look_img" title="点击查看大图" >
                                        @endif
                                    </td>
                                    <td>{{$value['settle_money']}}</td>
                                    <td>{{$value['transfer_account_money']}}</td>
                                    <td>{{$value['service_fee_rate']}}</td>
                                    <td>{{$value['submit_time']}}</td>
                                    <td>{{$value['settle_time']}}</td>
                                    <td>
                                        @switch($value['state'])
                                            @case(1)
                                            待提交
                                            @break

                                            @case(2)
                                            待结算
                                            @break

                                            @case(3)
                                            已结算
                                            @break

                                            @default
                                            无
                                        @endswitch
                                    </td>
                                    <td>
                                        @switch($value['is_refuse'])
                                            @case(1)
                                            已驳回
                                            @break
                                            @default
                                        @endswitch
                                    </td>
                                    <td>{{$value['reason']}}</td>
                                    <td class="td-manage">
                                        @if($value['state'] === 1)
                                            <button class="layui-btn layui-btn layui-btn-xs"  onclick="xadmin.open('修改收款信息','{{route("shop_account_settle_edit_page",["id"=>$value["id"]])}}')" ><i class="layui-icon">&#xe642;</i>修改收款信息</button>
                                        @if($value['is_refuse'] == 1)
                                                <button class="layui-btn-danger layui-btn layui-btn-xs ajax_member_del" data-href="{{route('shop_account_settle_submit_settle',['id'=>$value['id']])}}" data-title="确定提交结算吗？请谨慎操作" href="javascript:;" >重新提交</button>

                                            @else
                                                <button class="layui-btn-danger layui-btn layui-btn-xs ajax_member_del" data-href="{{route('shop_account_settle_submit_settle',['id'=>$value['id']])}}" data-title="确定提交结算吗？请谨慎操作" href="javascript:;" >提交结算</button>

                                            @endif
                                        @else
                                            <button class="layui-btn layui-btn layui-btn-xs layui-btn-disabled" ><i class="layui-icon">&#xe642;</i>修改收款信息</button>
                                            <button class="layui-btn-danger layui-btn layui-btn-xs layui-btn-disabled" >提交结算</button>
                                        @endif


{{--                                        <a title="编辑" onclick="xadmin.open('编辑','{{route('shop_account_settle_edit_page',['id'=>$value['id']])}}')" href="javascript:;">--}}
{{--                                            <i class="layui-icon"></i>--}}
{{--                                        </a>--}}
                                    </td>
                                </tr>
                            @endforeach
                            @else
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_data['page_link']}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection

@section('tab_js')
    <script>
        layui.use(['form','layer', 'jquery'], function () {
            $ = layui.jquery;
            var layer = layui.layer;

            //点击图片查看大图
            var bigImgIndex = null;
            $("body").on('click','.Look_img',function(){
                var img_src = $(this).attr('src');
                var img_infor = "<img border='0' src='" + img_src + "' />";
                bigImgIndex = layer.open({
                    content:img_infor,
                    type:1,
                    area:['auto'],
                    shadeClose: true,
                    shade:[0.4, '#000000'],
                    title:false,
                    closeBtn:true
                });
            });


        })

    </script>

@endsection




